
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Python3 进阶学习笔记 · 日常学习笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-footer-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../Shell/" />
    
    
    <link rel="prev" href="常用图像库学习.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"Xiechengqi","repo":"LearningNotes","type":"star","size":"small","count":true}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../网络学习资源整理/">
            
                <a href="../网络学习资源整理/">
            
                    
                    网络学习资源整理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../网络学习资源整理/技术学习.html">
            
                <a href="../网络学习资源整理/技术学习.html">
            
                    
                    技术学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../网络学习资源整理/运维博客.html">
            
                <a href="../网络学习资源整理/运维博客.html">
            
                    
                    运维博客
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../网络学习资源整理/工具.html">
            
                <a href="../网络学习资源整理/工具.html">
            
                    
                    工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../网络学习资源整理/静态博客模板.html">
            
                <a href="../网络学习资源整理/静态博客模板.html">
            
                    
                    静态博客模板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../网络学习资源整理/静态网站pages服务.html">
            
                <a href="../网络学习资源整理/静态网站pages服务.html">
            
                    
                    静态网站pages服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../网络学习资源整理/静态pages的CI和CD.html">
            
                <a href="../网络学习资源整理/静态pages的CI和CD.html">
            
                    
                    静态pages的CI和CD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../网络学习资源整理/Hugo学习.html">
            
                <a href="../网络学习资源整理/Hugo学习.html">
            
                    
                    Hugo学习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../心灵鸡汤/">
            
                <a href="../心灵鸡汤/">
            
                    
                    心灵鸡汤
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../心灵鸡汤/心灵鸡汤.html">
            
                <a href="../心灵鸡汤/心灵鸡汤.html">
            
                    
                    语录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../Linux/">
            
                <a href="../Linux/">
            
                    
                    Linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Linux/Linux常用命令.html">
            
                <a href="../Linux/Linux常用命令.html">
            
                    
                    Linux常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Linux/Linux小知识.html">
            
                <a href="../Linux/Linux小知识.html">
            
                    
                    平时 linux 遇到的问题解决办法和扩展小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Linux/Linux性能相关常用命令.html">
            
                <a href="../Linux/Linux性能相关常用命令.html">
            
                    
                    Linux性能相关常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Linux/Linux各种安装下载慢解决方法.html">
            
                <a href="../Linux/Linux各种安装下载慢解决方法.html">
            
                    
                    Linux各种安装下载慢解决方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../Linux/APT-剖析详解.html">
            
                <a href="../Linux/APT-剖析详解.html">
            
                    
                    APT 原理剖析、详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../Linux/Linux主机、虚拟机和docker网络配置.html">
            
                <a href="../Linux/Linux主机、虚拟机和docker网络配置.html">
            
                    
                    Linux 主机、虚拟机和docker网络配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../Linux/Linux文件系统学习.html">
            
                <a href="../Linux/Linux文件系统学习.html">
            
                    
                    Linux文件系统学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../Linux/Linux用户和用户组管理.html">
            
                <a href="../Linux/Linux用户和用户组管理.html">
            
                    
                    Linux用户和用户组管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../Linux/Linux用户增删改等学习.html">
            
                <a href="../Linux/Linux用户增删改等学习.html">
            
                    
                    Linux用户增删改等学习.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../Linux/Linux程序存放目录.html">
            
                <a href="../Linux/Linux程序存放目录.html">
            
                    
                    Linux程序存放目录.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="../Linux/Linux编译安装软件包详解.html">
            
                <a href="../Linux/Linux编译安装软件包详解.html">
            
                    
                    Linux C/C++ 软件包编译、安装原理详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" data-path="../Linux/SSH详解.html">
            
                <a href="../Linux/SSH详解.html">
            
                    
                    SSH 详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.13" data-path="../Linux/Tomcat和Ngnix和Apache.html">
            
                <a href="../Linux/Tomcat和Ngnix和Apache.html">
            
                    
                    Tomcat和Ngnix和Apache.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.14" data-path="../Linux/UbuntuSoftwareInstall.html">
            
                <a href="../Linux/UbuntuSoftwareInstall.html">
            
                    
                    Ubuntu 软件包安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.15" data-path="../Linux/YAML-配置文件语言.html">
            
                <a href="../Linux/YAML-配置文件语言.html">
            
                    
                    YAML 配置文件语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.16" data-path="../Linux/bin目录详解.html">
            
                <a href="../Linux/bin目录详解.html">
            
                    
                    bin目录详解.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.17" data-path="../Linux/ffmpeg详解.html">
            
                <a href="../Linux/ffmpeg详解.html">
            
                    
                    ffmpeg学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.18" data-path="../Linux/trans命令.html">
            
                <a href="../Linux/trans命令.html">
            
                    
                    trans命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.19" data-path="../Linux/yum和rpm.html">
            
                <a href="../Linux/yum和rpm.html">
            
                    
                    Yum 和 RPM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.20" data-path="../Linux/从BashShell启动“窥探”Linux环境变量相关文件.html">
            
                <a href="../Linux/从BashShell启动“窥探”Linux环境变量相关文件.html">
            
                    
                    Linux环境变量详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.21" data-path="../Linux/新创建主机常用初始化配置.html">
            
                <a href="../Linux/新创建主机常用初始化配置.html">
            
                    
                    新建主机常用初始化配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.22" data-path="../Linux/正则表达式学习.html">
            
                <a href="../Linux/正则表达式学习.html">
            
                    
                    正则表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.23" data-path="../Linux/通过Linux开机启动项展开学习.html">
            
                <a href="../Linux/通过Linux开机启动项展开学习.html">
            
                    
                    Linux开机启动项学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.24" data-path="../Linux/防火墙学习.html">
            
                <a href="../Linux/防火墙学习.html">
            
                    
                    防火墙学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="./">
            
                <a href="./">
            
                    
                    Python
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="BeautifulSoup.md">
            
                <span>
            
                    
                    Python3 BeautifulSoup 学习记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="Django.html">
            
                <a href="Django.html">
            
                    
                    Python Django 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="IPython使用技巧.html">
            
                <a href="IPython使用技巧.html">
            
                    
                    IPython 使用技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="Numpy.html">
            
                <a href="Numpy.html">
            
                    
                    Python Numpy 学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="Python小知识.html">
            
                <a href="Python小知识.html">
            
                    
                    Python 学习遇到的问题解决或扩展小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="Python模块管理总结.html">
            
                <a href="Python模块管理总结.html">
            
                    
                    Python 模块管理总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="flask学习.md">
            
                <span>
            
                    
                    Flask 学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="matplotlib.html">
            
                <a href="matplotlib.html">
            
                    
                    matplotlib.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="re正则表达式.html">
            
                <a href="re正则表达式.html">
            
                    
                    re正则表达式.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="图形界面学习.html">
            
                <a href="图形界面学习.html">
            
                    
                    图形界面学习.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.11" data-path="常用图像库学习.html">
            
                <a href="常用图像库学习.html">
            
                    
                    Python3 常用图像库
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.12" data-path="进阶学习.html">
            
                <a href="进阶学习.html">
            
                    
                    Python3 进阶学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../Shell/">
            
                <a href="../Shell/">
            
                    
                    Shell
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../Shell/shell小知识.html">
            
                <a href="../Shell/shell小知识.html">
            
                    
                    Shell小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../Shell/Shell奇淫技巧.html">
            
                <a href="../Shell/Shell奇淫技巧.html">
            
                    
                    Shell奇淫技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../Shell/Linux文本操作三大利器-grep、sed、awk.html">
            
                <a href="../Shell/Linux文本操作三大利器-grep、sed、awk.html">
            
                    
                    grep、sed、awk 详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../Shell/Shell文本处理常用工具补遗.html">
            
                <a href="../Shell/Shell文本处理常用工具补遗.html">
            
                    
                    Shell文本处理常用工具补遗
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../Shell/句子解析.html">
            
                <a href="../Shell/句子解析.html">
            
                    
                    句子解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../Shell/识别是否是root用户.html">
            
                <a href="../Shell/识别是否是root用户.html">
            
                    
                    识别是否是root用户
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../Shell/识别系统.html">
            
                <a href="../Shell/识别系统.html">
            
                    
                    识别系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../Vim/">
            
                <a href="../Vim/">
            
                    
                    Vim
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../Vim/Vim小知识.html">
            
                <a href="../Vim/Vim小知识.html">
            
                    
                    Vim小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../Vim/Vim编辑器再学习.html">
            
                <a href="../Vim/Vim编辑器再学习.html">
            
                    
                    Vim编辑器再学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../Vim/VimScript学习笔记.html">
            
                <a href="../Vim/VimScript学习笔记.html">
            
                    
                    VimScript 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../Vim/YouCompleteMe安装.html">
            
                <a href="../Vim/YouCompleteMe安装.html">
            
                    
                    YouCompleteMe安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../Vim/vimrc示例1.html">
            
                <a href="../Vim/vimrc示例1.html">
            
                    
                    vimrc示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../Vim/vimrc备份.html">
            
                <a href="../Vim/vimrc备份.html">
            
                    
                    vimrc备份
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../Vim/Tmux快捷键.html">
            
                <a href="../Vim/Tmux快捷键.html">
            
                    
                    Tmux快捷键
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../Ansible/">
            
                <a href="../Ansible/">
            
                    
                    Ansible
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../Ansible/术语表.html">
            
                <a href="../Ansible/术语表.html">
            
                    
                    术语表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../Ansible/Ansible必知单词.html">
            
                <a href="../Ansible/Ansible必知单词.html">
            
                    
                    Ansible 常用单词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../Ansible/Ansible学习.html">
            
                <a href="../Ansible/Ansible学习.html">
            
                    
                    Ansible 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../Ansible/Ansible常用模板.html">
            
                <a href="../Ansible/Ansible常用模板.html">
            
                    
                    Ansible常用模板.md
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../Docker/">
            
                <a href="../Docker/">
            
                    
                    Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../Docker/Docker基础学习.html">
            
                <a href="../Docker/Docker基础学习.html">
            
                    
                    Docker 基础学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../Docker/Docker小知识.html">
            
                <a href="../Docker/Docker小知识.html">
            
                    
                    Docker 小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../Docker/Docker必知单词.html">
            
                <a href="../Docker/Docker必知单词.html">
            
                    
                    Docker 学习中的单词
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../Git/">
            
                <a href="../Git/">
            
                    
                    Git
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../Git/git学习.html">
            
                <a href="../Git/git学习.html">
            
                    
                    Git 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../Git/git小技巧.html">
            
                <a href="../Git/git小技巧.html">
            
                    
                    Git 小技巧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../Zabbix/">
            
                <a href="../Zabbix/">
            
                    
                    Zabbix
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../Zabbix/Docker安装配置Zabbix.html">
            
                <a href="../Zabbix/Docker安装配置Zabbix.html">
            
                    
                    Docker 安装配置 Zabbix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../Zabbix/术语单词.html">
            
                <a href="../Zabbix/术语单词.html">
            
                    
                    Zabbix 中常用单词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../Zabbix/重置密码.html">
            
                <a href="../Zabbix/重置密码.html">
            
                    
                    重置 Zabbix 账户密码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../KVM/">
            
                <a href="../KVM/">
            
                    
                    KVM
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../KVM/安装配置.html">
            
                <a href="../KVM/安装配置.html">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../KVM/虚拟机网络配置.html">
            
                <a href="../KVM/虚拟机网络配置.html">
            
                    
                    Bridged 桥接模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../Mysql/">
            
                <a href="../Mysql/">
            
                    
                    Mysql
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../Mysql/Ubuntu安装Navicat.html">
            
                <a href="../Mysql/Ubuntu安装Navicat.html">
            
                    
                    Ubuntu 安装及配置 Navicat
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../Mysql/忘记root密码.html">
            
                <a href="../Mysql/忘记root密码.html">
            
                    
                    如何替换已忘记的 root 密码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../Nginx/">
            
                <a href="../Nginx/">
            
                    
                    Nginx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../Nginx/Nginx学习笔记.html">
            
                <a href="../Nginx/Nginx学习笔记.html">
            
                    
                    Nginx 学习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../NoClass/">
            
                <a href="../NoClass/">
            
                    
                    闲知
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../NoClass/容易读错的IT术语.html">
            
                <a href="../NoClass/容易读错的IT术语.html">
            
                    
                    容易读错的IT术语
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../NoClass/Linux-electron-tutorial.html">
            
                <a href="../NoClass/Linux-electron-tutorial.html">
            
                    
                    Linux electron 学习记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../NoClass/MarkdownSkills.html">
            
                <a href="../NoClass/MarkdownSkills.html">
            
                    
                    记录 Markdown 的各种小技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../NoClass/RaspeberryPi.html">
            
                <a href="../NoClass/RaspeberryPi.html">
            
                    
                    使用树莓派 3B 遇到的问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.5" data-path="../NoClass/华为国产手机芯片SoC.html">
            
                <a href="../NoClass/华为国产手机芯片SoC.html">
            
                    
                    华为国产手机芯片SoC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.6" data-path="../NoClass/图片格式详解及其对比.html">
            
                <a href="../NoClass/图片格式详解及其对比.html">
            
                    
                    图片格式详解及其对比
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.7" data-path="../NoClass/计算机小知识.html">
            
                <a href="../NoClass/计算机小知识.html">
            
                    
                    记录一些计算机的小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.8" data-path="../NoClass/诗词.html">
            
                <a href="../NoClass/诗词.html">
            
                    
                    诗词
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../OS/">
            
                <a href="../OS/">
            
                    
                    OS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" data-path="../OS/学习笔记.html">
            
                <a href="../OS/学习笔记.html">
            
                    
                    操作系统学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../OS/术语单词.html">
            
                <a href="../OS/术语单词.html">
            
                    
                    OS 专业词语解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" data-path="../OS/SoCCPU.html">
            
                <a href="../OS/SoCCPU.html">
            
                    
                    SoC 与 CPU
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../Tomcat/">
            
                <a href="../Tomcat/">
            
                    
                    Tomcat
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../Tomcat/Tomcat 学习.html">
            
                <a href="../Tomcat/Tomcat 学习.html">
            
                    
                    Tomcat 学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../Tomcat/Tomcat学习.html">
            
                <a href="../Tomcat/Tomcat学习.html">
            
                    
                    Tomcat 学习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../VPS/">
            
                <a href="../VPS/">
            
                    
                    VPS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" data-path="../VPS/AWS_lightsail.html">
            
                <a href="../VPS/AWS_lightsail.html">
            
                    
                    AWS LightSail
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.2" data-path="../VPS/GCP_VM实例创建和基本配置.html">
            
                <a href="../VPS/GCP_VM实例创建和基本配置.html">
            
                    
                    GCP VM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.3" data-path="../VPS/ECS和VPS等等.html">
            
                <a href="../VPS/ECS和VPS等等.html">
            
                    
                    ECS和VPS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../ComputerComposition/">
            
                <a href="../ComputerComposition/">
            
                    
                    ComputerComposition
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.19.1" data-path="../ComputerComposition/学习笔记.html">
            
                <a href="../ComputerComposition/学习笔记.html">
            
                    
                    计算机组成原理学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="../ComputerNetwork/">
            
                <a href="../ComputerNetwork/">
            
                    
                    ComputerNetwork
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.20.1" data-path="../ComputerNetwork/ProWords.html">
            
                <a href="../ComputerNetwork/ProWords.html">
            
                    
                    术语单词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.2" data-path="../ComputerNetwork/学习笔记.html">
            
                <a href="../ComputerNetwork/学习笔记.html">
            
                    
                    计算机网络学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.3" data-path="../ComputerNetwork/小知识.html">
            
                <a href="../ComputerNetwork/小知识.html">
            
                    
                    学习计算机网络中的小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.4" data-path="../NoClass/浏览器架构简析.md">
            
                <span>
            
                    
                    浏览器架构简析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="../毕业论文/">
            
                <a href="../毕业论文/">
            
                    
                    毕业论文
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.21.1" data-path="../毕业论文/开题报告.html">
            
                <a href="../毕业论文/开题报告.html">
            
                    
                    开题报告
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Python3 进阶学习笔记</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="python3-&#x8FDB;&#x9636;&#x5B66;&#x4E60;&#x7B14;&#x8BB0;"><a name="python3-&#x8FDB;&#x9636;&#x5B66;&#x4E60;&#x7B14;&#x8BB0;" class="plugin-anchor" href="#python3-&#x8FDB;&#x9636;&#x5B66;&#x4E60;&#x7B14;&#x8BB0;"><i class="fa fa-link" aria-hidden="true"></i></a>Python3 &#x8FDB;&#x9636;&#x5B66;&#x4E60;&#x7B14;&#x8BB0;</h1>
<h2 id="&#x51FD;&#x6570;&#x6807;&#x51C6;&#x53C2;&#x6570;&#x3001;args-&#x4E0E;-kwargs"><a name="&#x51FD;&#x6570;&#x6807;&#x51C6;&#x53C2;&#x6570;&#x3001;args-&#x4E0E;-kwargs" class="plugin-anchor" href="#&#x51FD;&#x6570;&#x6807;&#x51C6;&#x53C2;&#x6570;&#x3001;args-&#x4E0E;-kwargs"><i class="fa fa-link" aria-hidden="true"></i></a>&#x51FD;&#x6570;&#x6807;&#x51C6;&#x53C2;&#x6570;&#x3001;<em>args &#x4E0E; *</em>kwargs</h2>
<ul>
<li>Python &#x5141;&#x8BB8;&#x51FD;&#x6570;&#x7684;&#x5728;&#x5B9A;&#x4E49;&#x65F6;&#x4E0D;&#x5FC5;&#x786E;&#x5B9A;&#x5F62;&#x53C2;&#x7684;&#x6570;&#x91CF;&#xFF0C;&#x7528; &apos;*&apos; &#x8868;&#x793A;&#x4E0D;&#x786E;&#x5B9A;&#x7684;&#x5F62;&#x53C2;</li>
<li><code>*args</code> &#x548C; <code>**kwargs</code> &#x662F;&#x4E00;&#x79CD;&#x5E38;&#x7528;&#x7684;&#x4E0D;&#x786E;&#x5B9A;&#x6570;&#x91CF;&#x5F62;&#x53C2;&#x7684;&#x8868;&#x793A;&#xFF0C;&#x4F46;&#x53EA;&#x6709; <code>*</code> &#x662F;&#x5FC5;&#x987B;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x4E5F;&#x53EF;&#x4EE5;&#x7528;&#x7C7B;&#x4F3C; <code>*var</code> &#x548C; <code>**vars**</code> &#x6765;&#x8868;&#x793A;</li>
<li><code>*args</code><ul>
<li>&#x8868;&#x793A;&#x4E0D;&#x786E;&#x5B9A;&#x6570;&#x91CF;&#x7684;&#x975E;&#x952E;&#x503C;&#x5BF9;&#x53C2;&#x6570;</li>
<li>args &#x53EF;&#x4EE5;&#x662F;&#x5143;&#x7EC4; ( tuple ) &#x6216;&#x5217;&#x8868; ( list ) &#x7B49;</li>
</ul>
</li>
<li><code>**kwargs</code><ul>
<li>&#x8868;&#x793A;&#x4E0D;&#x786E;&#x5B9A;&#x6570;&#x91CF;&#x7684;&#x952E;&#x503C;&#x5BF9;&#x53C2;&#x6570;</li>
<li>kwargs &#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x5178; ( dictionary ) &#x7B49;</li>
</ul>
</li>
<li>&#x5F53;&#x8981;&#x5728;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x4E2D;&#x4F20;&#x5165;&#x4EE5;&#x4E0A;&#x4E09;&#x79CD;&#x7C7B;&#x578B;&#x8868;&#x793A;&#x7684;&#x5F62;&#x53C2;&#xFF0C;&#x987A;&#x5E8F;&#x5982;&#x4E0B;&#xFF1A;<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">some_func</span><span class="hljs-params">(fargs, *args, **kwargs)</span>:</span>
</code></pre>
<h2 id="&#x533F;&#x540D;&#x51FD;&#x6570;---lambda"><a name="&#x533F;&#x540D;&#x51FD;&#x6570;---lambda" class="plugin-anchor" href="#&#x533F;&#x540D;&#x51FD;&#x6570;---lambda"><i class="fa fa-link" aria-hidden="true"></i></a>&#x533F;&#x540D;&#x51FD;&#x6570; - lambda</h2>
</li>
</ul>
<blockquote>
<p>&#x5728; python &#x4E2D;&#xFF0C;&#x9664;&#x4E86;&#x4E00;&#x822C;&#x4F7F;&#x7528; def &#x5B9A;&#x4E49;&#x7684;&#x51FD;&#x6570;&#x5916;&#xFF0C;&#x8FD8;&#x6709;&#x4E00;&#x79CD;&#x4F7F;&#x7528; <strong>lambda</strong> &#x5B9A;&#x4E49;&#x7684;&#x533F;&#x540D;&#x51FD;&#x6570;&#x3002;&#x8FD9;&#x79CD;&#x51FD;&#x6570;&#x53EF;&#x4EE5;&#x7528;&#x5728;&#x4EFB;&#x4F55;&#x666E;&#x901A;&#x51FD;&#x6570;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7684;&#x5730;&#x65B9;&#xFF0C;&#x4F46;&#x5728;&#x5B9A;&#x4E49;&#x65F6;&#x88AB;&#x4E25;&#x683C;&#x9650;&#x5B9A;&#x4E3A;<strong>&#x5355;&#x4E00;&#x8868;&#x8FBE;&#x5F0F;</strong></p>
</blockquote>
<pre><code class="lang-python"><span class="hljs-comment"># lambda &#x8868;&#x8FBE;&#x5F0F;&#x683C;&#x5F0F;&#xFF1A;</span>
<span class="hljs-comment"># lambda &#x53D8;&#x91CF; 1 , &#x53D8;&#x91CF; 2 ,...&#x53D8;&#x91CF; N : &#x542B;&#x6709;&#x53D8;&#x91CF;&#x7684;&#x8868;&#x8FBE;&#x5F0F;</span>
<span class="hljs-comment"># &#x4F8B;&#x5982;&#xFF1A;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>x1 = <span class="hljs-number">1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>x2 = <span class="hljs-number">2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>test = <span class="hljs-keyword">lambda</span> x1 , x2 : x1 + x2
<span class="hljs-meta">&gt;&gt;&gt; </span>test(x1 , x2)
<span class="hljs-number">3</span>
</code></pre>
<h2 id="&#x751F;&#x6210;&#x5668;---generators"><a name="&#x751F;&#x6210;&#x5668;---generators" class="plugin-anchor" href="#&#x751F;&#x6210;&#x5668;---generators"><i class="fa fa-link" aria-hidden="true"></i></a>&#x751F;&#x6210;&#x5668; - Generators</h2>
<h3 id="&#x751F;&#x6210;&#x5668;&#x7684;&#x57FA;&#x7840;---&#x8FED;&#x4EE3;"><a name="&#x751F;&#x6210;&#x5668;&#x7684;&#x57FA;&#x7840;---&#x8FED;&#x4EE3;" class="plugin-anchor" href="#&#x751F;&#x6210;&#x5668;&#x7684;&#x57FA;&#x7840;---&#x8FED;&#x4EE3;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x751F;&#x6210;&#x5668;&#x7684;&#x57FA;&#x7840; - &#x8FED;&#x4EE3;</h3>
<ul>
<li><p>&#x53EF;&#x8FED;&#x4EE3;&#x5BF9;&#x8C61; - Iterable</p>
<ul>
<li>Python &#x4E2D;&#x4EFB;&#x610F;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x53EA;&#x8981;&#x5B83;&#x5B9A;&#x4E49;&#x4E86;&#x53EF;&#x4EE5;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x8FED;&#x4EE3;&#x5668;&#x7684; <code>__iter__</code> &#x65B9;&#x6CD5;&#xFF0C;&#x6216;&#x8005;&#x5B9A;&#x4E49;&#x4E86;&#x53EF;&#x4EE5;&#x652F;&#x6301;&#x4E0B;&#x6807;&#x7D22;&#x5F15;&#x7684; <code>__getitem__</code> &#x65B9;&#x6CD5;&#xFF0C;&#x90A3;&#x4E48;&#x5B83;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x8FED;&#x4EE3;&#x5BF9;&#x8C61;&#x3002;&#x7B80;&#x5355;&#x8BF4;&#xFF0C;&#x53EF;&#x8FED;&#x4EE3;&#x5BF9;&#x8C61;&#x5C31;&#x662F;&#x80FD;&#x63D0;&#x4F9B;&#x8FED;&#x4EE3;&#x5668;&#x7684;&#x4EFB;&#x610F;&#x5BF9;&#x8C61;</li>
</ul>
</li>
<li><p>&#x8FED;&#x4EE3;&#x5668; - Iterator</p>
<ul>
<li>&#x4EFB;&#x610F;&#x5BF9;&#x8C61;&#xFF0C;&#x53EA;&#x8981;&#x5B9A;&#x4E49;&#x4E86; next ( Python2 ) &#x6216;&#x8005; <code>__next__</code> &#x65B9;&#x6CD5;&#xFF0C;&#x5B83;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x8FED;&#x4EE3;&#x5668;</li>
</ul>
</li>
<li>&#x8FED;&#x4EE3; - Iteration<ul>
<li>&#x7528;&#x7B80;&#x5355;&#x7684;&#x8BDD;&#x8BB2;&#xFF0C;&#x5B83;&#x5C31;&#x662F;&#x4ECE;&#x67D0;&#x4E2A;&#x5730;&#x65B9;&#xFF08; &#x6BD4;&#x5982;&#x4E00;&#x4E2A;&#x5217;&#x8868; &#xFF09;&#x53D6;&#x51FA;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x8FC7;&#x7A0B;&#x3002;&#x5F53;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x5FAA;&#x73AF;&#x6765;&#x904D;&#x5386;&#x67D0;&#x4E2A;&#x4E1C;&#x897F;&#x65F6;&#xFF0C;&#x8FD9;&#x4E2A;&#x8FC7;&#x7A0B;&#x672C;&#x8EAB;&#x5C31;&#x53EB;&#x8FED;&#x4EE3;</li>
</ul>
</li>
</ul>
<h3 id="&#x751F;&#x6210;&#x5668;"><a name="&#x751F;&#x6210;&#x5668;" class="plugin-anchor" href="#&#x751F;&#x6210;&#x5668;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x751F;&#x6210;&#x5668;</h3>
<blockquote>
<p>&#x5355;&#x7EAF;&#x7531;&#x5FAA;&#x73AF;&#x63A7;&#x5236;&#x7684;&#x8FED;&#x4EE3;&#x7684;&#x6267;&#x884C;&#x5F80;&#x5F80;&#x4F1A;&#x6D88;&#x8017;&#x5927;&#x91CF;&#x5185;&#x5B58;&#xFF0C;&#x4E5F;&#x4F1A;&#x4E00;&#x6B21;&#x6027;&#x4EA7;&#x751F;&#x6240;&#x6709;&#x7ED3;&#x679C;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;&#x5BF9;&#x4E8E;&#x6BCF;&#x6B21;&#x53EA;&#x9700;&#x8981;&#x8FED;&#x4EE3;&#x8FC7;&#x7A0B;&#x4E2D;&#x67D0;&#x4E00;&#x4E2A;&#x7ED3;&#x679C;&#x7684;&#x8981;&#x6C42;&#xFF0C;&#x4F7F;&#x7528;&#x8FED;&#x4EE3;&#x5F80;&#x5F80;&#x4F1A;&#x6D6A;&#x8D39;&#x65F6;&#x95F4;&#x3001;&#x7A7A;&#x95F4;&#xFF0C;&#x6BD4;&#x5982;&#x6BCF;&#x6B21;&#x90FD;&#x8981;&#x4E00;&#x4E2A;&#x53EA;&#x9700;&#x51E0;&#x6B21;&#x8FED;&#x4EE3;&#x5C31;&#x80FD;&#x5F97;&#x5230;&#x7684;&#x7ED3;&#x679C;&#xFF0C;&#x4F46;&#x82E5;&#x7531;&#x5FAA;&#x73AF;&#x76F4;&#x63A5;&#x63A7;&#x5236;&#x8FED;&#x4EE3;&#x5219;&#x6BCF;&#x6B21;&#x90FD;&#x8981;&#x5B8C;&#x6210;&#x6240;&#x6709;&#x8FED;&#x4EE3;&#xFF0C;&#x8FD4;&#x56DE;&#x6240;&#x6709;&#x7ED3;&#x679C;&#x3002;&#x5229;&#x7528;&#x751F;&#x6210;&#x5668;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x63A7;&#x5236;&#x5FAA;&#x73AF;&#x4E2D;&#x7684;&#x8FED;&#x4EE3;</p>
</blockquote>
<ul>
<li>&#x751F;&#x6210;&#x5668;&#x4E5F;&#x662F;&#x4E00;&#x79CD;&#x8FED;&#x4EE3;&#x5668;&#xFF0C;&#x4F46;&#x662F;&#x4F60;&#x53EA;&#x80FD;&#x5BF9;&#x5176;&#x8FED;&#x4EE3;&#x4E00;&#x6B21;&#x3002;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x5B83;&#x4EEC;&#x5E76;&#x6CA1;&#x6709;&#x628A;&#x6240;&#x6709;&#x7684;&#x503C;&#x5B58;&#x5728;&#x5185;&#x5B58;&#x4E2D;&#xFF0C;&#x800C;&#x662F;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x751F;&#x6210;&#x503C;&#x3002;&#x4F60;&#x901A;&#x8FC7;&#x904D;&#x5386;&#x6765;&#x4F7F;&#x7528;&#x5B83;&#x4EEC;&#xFF0C;&#x8981;&#x4E48;&#x7528;&#x4E00;&#x4E2A; &#x201C;for&#x201D; 
&#x5FAA;&#x73AF;&#xFF0C;&#x8981;&#x4E48;&#x5C06;&#x5B83;&#x4EEC;&#x4F20;&#x9012;&#x7ED9;&#x4EFB;&#x610F;&#x53EF;&#x4EE5;&#x8FDB;&#x884C;&#x8FED;&#x4EE3;&#x7684;&#x51FD;&#x6570;&#x548C;&#x7ED3;&#x6784;</li>
<li>&#x751F;&#x6210;&#x5668;&#x6700;&#x4F73;&#x5E94;&#x7528;&#x573A;&#x666F;&#x662F;&#xFF1A;&#x4F60;&#x4E0D;&#x60F3;&#x540C;&#x4E00;&#x65F6;&#x95F4;&#x5C06;&#x6240;&#x6709;&#x8BA1;&#x7B97;&#x51FA;&#x6765;&#x7684;&#x5927;&#x91CF;&#x7ED3;&#x679C;&#x96C6;&#x5206;&#x914D;&#x5230;&#x5185;&#x5B58;&#x5F53;&#x4E2D;&#xFF0C;&#x7279;&#x522B;&#x662F;&#x7ED3;&#x679C;&#x96C6;&#x91CC;&#x8FD8;&#x5305;&#x542B;&#x5FAA;&#x73AF;</li>
</ul>
<h2 id="&#x5404;&#x79CD;&#x63A8;&#x5BFC;&#x5F0F;---comprehensions"><a name="&#x5404;&#x79CD;&#x63A8;&#x5BFC;&#x5F0F;---comprehensions" class="plugin-anchor" href="#&#x5404;&#x79CD;&#x63A8;&#x5BFC;&#x5F0F;---comprehensions"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5404;&#x79CD;&#x63A8;&#x5BFC;&#x5F0F; - comprehensions</h2>
<ul>
<li>&#x63A8;&#x5BFC;&#x5F0F;&#xFF08; &#x53C8;&#x79F0;&#x89E3;&#x6790;&#x5F0F; &#xFF09;&#x662F; Python &#x7684;&#x4E00;&#x79CD;&#x72EC;&#x6709;&#x7279;&#x6027;</li>
<li>&#x63A8;&#x5BFC;&#x5F0F;&#x662F;&#x53EF;&#x4EE5;&#x4ECE;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5E8F;&#x5217;&#x6784;&#x5EFA;&#x53E6;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x6570;&#x636E;&#x5E8F;&#x5217;&#x7684;&#x7ED3;&#x6784;&#x4F53;&#xFF0C;&#x5171;&#x6709;&#x4E09;&#x79CD;&#x63A8;&#x5BFC;&#xFF0C;&#x5728; Python2 &#x548C; 3 &#x4E2D;&#x90FD;&#x6709;&#x652F;&#x6301;&#xFF1A;<ul>
<li>&#x5217;&#x8868; ( list ) &#x63A8;&#x5BFC;&#x5F0F;</li>
<li>&#x5B57;&#x5178; ( dict ) &#x63A8;&#x5BFC;&#x5F0F;</li>
<li>&#x96C6;&#x5408; ( set ) &#x63A8;&#x5BFC;&#x5F0F;</li>
</ul>
</li>
</ul>
<h2 id="&#x96C6;&#x5408;---set"><a name="&#x96C6;&#x5408;---set" class="plugin-anchor" href="#&#x96C6;&#x5408;---set"><i class="fa fa-link" aria-hidden="true"></i></a>&#x96C6;&#x5408; - Set</h2>
<p>Set&#xFF08; &#x96C6;&#x5408; &#xFF09;&#x662F;&#x4E00;&#x79CD;&#x6570;&#x636E;&#x7ED3;&#x6784;&#xFF0C;&#x5F62;&#x5F0F;&#x5982;&#xFF1A; <code>{1, 2, 3, 4}</code>&#xFF0C;&#x96C6;&#x5408;&#x4E2D;&#x4E0D;&#x80FD;&#x6709;&#x91CD;&#x590D;&#x7684;&#x5143;&#x7D20;&#xFF08; &#x548C;&#x6570;&#x5B66;&#x91CC;&#x7684;&#x5B9A;&#x4E49;&#x4E00;&#x6837; &#xFF09;</p>
<h3 id="&#x5E94;&#x7528;&#x573A;&#x666F;"><a name="&#x5E94;&#x7528;&#x573A;&#x666F;" class="plugin-anchor" href="#&#x5E94;&#x7528;&#x573A;&#x666F;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5E94;&#x7528;&#x573A;&#x666F;</h3>
<ol>
<li>&#x68C0;&#x67E5;&#x5217;&#x8868;&#x4E2D;&#x662F;&#x5426;&#x5305;&#x542B;&#x91CD;&#x590D;&#x7684;&#x5143;&#x7D20;</li>
</ol>
<pre><code class="lang-python"><span class="hljs-meta">&gt;&gt;&gt; </span>some_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">4</span>, <span class="hljs-number">2</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>chongfu = [ x <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> some_list <span class="hljs-keyword">if</span> some_list.count(x) &gt; <span class="hljs-number">1</span> ]
<span class="hljs-meta">&gt;&gt;&gt; </span>print(chongfu)
[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>chongfu = set([ x <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> some_list <span class="hljs-keyword">if</span> some_list.count(x) &gt; <span class="hljs-number">1</span> ])
<span class="hljs-meta">&gt;&gt;&gt; </span>print(chongfu)
{<span class="hljs-number">1</span>, <span class="hljs-number">2</span>}
</code></pre>
<ol>
<li>&#x4E24;&#x4E2A;&#x96C6;&#x5408;&#x7684;&#x4EA4;&#x96C6; - <strong>intersection</strong></li>
</ol>
<pre><code class="lang-pyhton">&gt;&gt;&gt; set1 = set([1, 2, 3, 4, 5])
&gt;&gt;&gt; set2 = set([1, 7, 8])
&gt;&gt;&gt; print(set1.intersection(set2))
{1}
&gt;&gt;&gt; print(set2.intersection(set1))
{1}
</code></pre>
<ol>
<li>&#x4E24;&#x4E2A;&#x96C6;&#x5408;&#x7684;&#x5DEE;&#x96C6; - <strong>difference</strong></li>
</ol>
<pre><code class="lang-python"><span class="hljs-meta">&gt;&gt;&gt; </span>set1 = set([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>set2 = set([<span class="hljs-number">1</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>print(set1.difference(set2))
{<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>print(set2.difference(set1))
{<span class="hljs-number">8</span>, <span class="hljs-number">7</span>}
</code></pre>
<footer class="page-footer-ex"> <span class="page-footer-ex-copyright"> <a href="https://github.com/Xiechengqi" target="_blank">Xiechengqi</a> </span> &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <span class="page-footer-ex-footer-update"> <strong>&#x6700;&#x65B0;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;</strong> 2020-01-04 15:54:39 </span> </footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="常用图像库学习.html" class="navigation navigation-prev " aria-label="Previous page: Python3 常用图像库">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../Shell/" class="navigation navigation-next " aria-label="Next page: Shell">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Python3 进阶学习笔记","level":"1.5.12","depth":2,"next":{"title":"Shell","level":"1.6","depth":1,"path":"Shell/README.md","ref":"Shell/README.md","articles":[{"title":"Shell小知识","level":"1.6.1","depth":2,"path":"Shell/shell小知识.md","ref":"Shell/shell小知识.md","articles":[]},{"title":"Shell奇淫技巧","level":"1.6.2","depth":2,"path":"Shell/Shell奇淫技巧.md","ref":"Shell/Shell奇淫技巧.md","articles":[]},{"title":"grep、sed、awk 详解","level":"1.6.3","depth":2,"path":"Shell/Linux文本操作三大利器-grep、sed、awk.md","ref":"Shell/Linux文本操作三大利器-grep、sed、awk.md","articles":[]},{"title":"Shell文本处理常用工具补遗","level":"1.6.4","depth":2,"path":"Shell/Shell文本处理常用工具补遗.md","ref":"Shell/Shell文本处理常用工具补遗.md","articles":[]},{"title":"句子解析","level":"1.6.5","depth":2,"path":"Shell/句子解析.md","ref":"Shell/句子解析.md","articles":[]},{"title":"识别是否是root用户","level":"1.6.6","depth":2,"path":"Shell/识别是否是root用户.md","ref":"Shell/识别是否是root用户.md","articles":[]},{"title":"识别系统","level":"1.6.7","depth":2,"path":"Shell/识别系统.md","ref":"Shell/识别系统.md","articles":[]}]},"previous":{"title":"Python3 常用图像库","level":"1.5.11","depth":2,"path":"Python/常用图像库学习.md","ref":"Python/常用图像库学习.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","-livereload","-sharing","expandable-chapters","popup","pageview-count","code","back-to-top-button","hide-element","github-buttons","github","splitter","search-pro","anchors","page-footer-ex","advanced-emoji","sharing-plus"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/Xiechengqi/LearningNotes"},"page-footer-ex":{"copyright":"[Xiechengqi](https://github.com/Xiechengqi)","markdown":true,"update_format":"YYYY-MM-DD HH:mm:ss","update_label":"<strong>最新修订时间：</strong>"},"splitter":{},"search-pro":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"back-to-top-button":{},"pageview-count":{},"github-buttons":{"buttons":[{"user":"Xiechengqi","repo":"LearningNotes","type":"star","size":"small","count":true}]},"advanced-emoji":{"embedEmojis":false},"sharing":{"qq":false,"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"日常学习笔记","language":"zh-hans","gitbook":"*","description":"日常学习笔记"},"file":{"path":"Python/进阶学习.md","mtime":"2020-01-04T07:54:39.012Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-28T02:57:41.582Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

